platform: linux
inputs:
 - name: ccp_src
 - name: cluster_env_files
 - name: sqldump
run:
  path: bash
  args:
  - -c
  - |
    set -ex
    ccp_src/scripts/setup_ssh_to_cluster.sh
    ssh -t cdw "HOST1=cdw HOST2=sdw1 HOST3=sdw2 HOST4=sdw3 HOST5=sdw4 \
      bash -c 'ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub; for i in cdw sdw{1..4}; do ssh ${SUDO_CDW_USERNAME}@\$i \"sudo chmod 777 /usr/local\"; done'"
    ssh -t cdw 'mkdir -p /home/gpadmin/sqldump'
    scp sqldump/* cdw:/home/gpadmin/sqldump/
    ssh -t cdw 'xz -d /home/gpadmin/sqldump/dump.sql.xz'
